<!-- 危化品管理-基本资料-智能柜 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="6">
            <el-form-item label="智能柜名称">
              <el-input v-model="listQuery.fuser" placeholder="智能柜名称" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="存储分类">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <template v-if="showAll">
            <el-col :span="6">
            <el-form-item label="固定资产码">
              <el-input v-model="listQuery.fuser" placeholder="固定资产码" clearable />
            </el-form-item>
           </el-col>

            <el-col :span="6">
            <el-form-item label="所属教学楼">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="所属楼层">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
          <el-form-item label="标签类型">
            <el-select v-model="listQuery.fcustomno" placeholder="请选择"
              :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                v-for="item in options4"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          </el-col>

          <el-col :span="6">
          <el-form-item label="设备状态">
            <el-select v-model="listQuery.fcustomno" placeholder="请选择"
              :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                v-for="item in options3"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          </el-col>

          </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button>
              <!-- <el-button type="success" icon="el-icon-download">导出</el-button> -->
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <!-- <el-table-column prop="FGROUP" label="教学楼"></el-table-column> -->
          <!-- <el-table-column prop="FLEVEL" label="楼层"></el-table-column> -->
          <el-table-column prop="FPOINT" label="场地名称"></el-table-column>
          <!-- <el-table-column prop="FSERNU" label="设备序列号"></el-table-column> -->
          <el-table-column prop="FACCNO" label="固定资产码"></el-table-column>
          <el-table-column prop="FCATNAME" label="智能柜名称"></el-table-column>
          <el-table-column prop="FCLASS" label="存储分类"></el-table-column>
          <el-table-column prop="FLABEL" label="标签类型"></el-table-column>
          <el-table-column prop="FSTATE" label="设备状态" ></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="150">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                编辑
              </el-button>
             <el-popconfirm title="确定删除当前数据吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-delete" style="color: red;margin-left: 10px;"
                  type="text">删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '申请中'
        }, {
          value: '2',
          label: '已通过'
        }, {
          value: '3',
          label: '已驳回'
        }],

        customlist:[
          {
            "FBILLNO": "K241130001", 
            "FBILLCREDATE":"2024-11-30",
            "FUSER": "曹操",
            "FMEMO": "有机化学实验操作课",
            "FBEGDATE": "2024-12-01",
            "FENDDATE": "2025-11-30",
            "FCHECKUSE": "",
            "FCHECKDATE": "",
            "FNOTE":"",
            "FBILLSTATE": "申请中"
          },
        ],
        list: [
            {
            "FSERNU":"BAE684FF8821CBE3",
            "FACCNO":"SHYL0001",
            "FCATNAME":"测试RFID柜-1",
            "FCLASS":"易制毒",
            "FLABEL":"RFID柜",
            "FGROUP":"第一教学楼",
            "FLEVEL":"二楼",
            "FPOINT":"奉化学楼202",
            "FSTATE":"正常"
            },{
            "FSERNU":"BAE684FF8821TGH5",
            "FACCNO":"SHYL0002",
            "FCATNAME":"测试RFID柜-2",
            "FCLASS":"易制毒",
            "FLABEL":"RFID柜",
            "FGROUP":"第一教学楼",
            "FLEVEL":"二楼",
            "FPOINT":"奉化学楼202",
            "FSTATE":"正常"
            },
            ,{
            "FSERNU":"ADE684FF8821TGH5",
            "FACCNO":"TMYL0001",
            "FCATNAME":"测试二维码柜-1",
            "FCLASS":"一般化学品",
            "FLABEL":"二维码柜",
            "FGROUP":"第一教学楼",
            "FLEVEL":"一楼",
            "FPOINT":"奉化学楼101",
            "FSTATE":"正常"
            },{
            "FSERNU":"ADE684FF9635TGH5",
            "FACCNO":"TMYL0002",
            "FCATNAME":"测试二维码柜-2",
            "FCLASS":"一般化学品",
            "FLABEL":"二维码柜",
            "FGROUP":"第一教学楼",
            "FLEVEL":"一楼",
            "FPOINT":"奉化学楼102",
            "FSTATE":"正常"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },

        //所属教学楼选择数据
        options1: [{
          value: '20E01',
          label: '第一教学楼'
        }, {
          value: '20E02',
          label: '第二教学楼'
        }, {
          value: '20N01',
          label: '第一实验楼'
        }, {
          value: '20N02',
          label: '第二实验楼'
        }],

        //所属楼层选择数据
        options2: [{
          value: '20E01',
          label: '一楼'
        }, {
          value: '20E02',
          label: '二楼'
        }, {
          value: '20N01',
          label: '三楼'
        }, {
          value: '20N02',
          label: '四楼'
        }],

        //
        options3: [{
          value: '20E01',
          label: '正常'
        }, {
          value: '20E02',
          label: '维修'
        }, {
          value: '20N01',
          label: '保养'
        }, {
          value: '20N02',
          label: '停用'
        }],

        options4: [{
          value: '1',
          label: '易制毒'
        }, {
          value: '2',
          label: '易制爆'
        }, {
          value: '3',
          label: '一般化学品'
        }, {
          value: '4',
          label: '剧毒品'
        }, {
          value: '5',
          label: '危险化学品'
        }],

        options5: [{
          value: '1',
          label: 'RFID柜'
        }, {
          value: '2',
          label: '二维码柜'
        }],

      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>